﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using NDF.Data.EntityFramework;
using System.Data.Entity;
using UA.Data.Model;

namespace UA.Data
{
    public class UADbContext : NDF.Data.EntityFramework.DbContext
    {

        public UADbContext() : base("name=UADemo")
        {
        }




        public virtual DbSet<Role> Roles { get; set; }

        public virtual DbSet<User> Users { get; set; }

        public virtual DbSet<UserRole> UserRoles { get; set; }

        public virtual DbSet<Power> Powers { get; set; }

        public virtual DbSet<RolePower> RolePowers { get; set; }

        public virtual DbSet<Application> Applications { get; set; }

        public virtual DbSet<AppPower> AppPowers { get; set; }

        public virtual DbSet<UA.Data.Model.AppDomain> AppDomains { get; set; }

        public virtual DbSet<Ticket> Tickets { get; set; }

        public virtual DbSet<Session> Sessions { get; set; }




        protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }



        public static void Initialize()
        {
            Database.SetInitializer<UADbContext>(new UADemoDbInitializer());
        }

    }
}
